//chatboxi teksti lisamine
function addText() {
	var input = document.getElementById("chatinput").value;
	text_add = document.createElement("textenter");
	textbox = document.getElementById('textarea');
	textbox.appendChild(text_add);
	if (input != "") text_add.innerHTML = "<b>You: </b>"+ input + "<br />"
	textbox.scrollTop = textbox.scrollHeight;
	document.getElementById("chatinput").value = "";
}
//Enteri vajutusel käivitakse addText funktsioon
function pressEnter(myfield,e) {
	var keycode;
	if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
			else return true;
	if (keycode == 13) {
		addText();
	   return false;
	  }
	else
	   return true;
}
//Koodiosa kasutaja fold jaoks
var ClickCount = 0;
function showFold() {
	var clickLimit = 1; 
	if(ClickCount>=clickLimit ) {
		//alert("Foldisite edukalt! Te ei saa rohkem foldida!")
			return false;
	}
	else {
		var a = document.createElement('text');
		 a.innerHTML = "<i><b>You </b>"+ "folded.<i>" + "<br />";
		document.getElementById('textarea').appendChild(a);
		ClickCount++;
		//alert("Foldisite edukalt!")
		return true;
	}
	
}